package ds.factcom.controller.invoice;

import java.util.Observer;

import javax.swing.table.TableModel;

import ds.factcom.controller.client.IClientController;
import ds.factcom.controller.product.IProductController;
import ds.factcom.domain.invoice.Invoice;
import ds.factcom.domain.product.Product;
import ds.factcom.exception.EmptyListProductException;
import ds.factcom.exception.NotDefinedClientException;
import ds.factcom.exception.NotExistDomainException;
import ds.factcom.model.InvoiceModel;

/**
 * 
 * @author Javier De Luca, Maximiliano Herrera, Matias Samblancat
 * 
 */
public class InvoiceController implements IClientController, IProductController{

	private final InvoiceModel invoiceModel;

	public InvoiceController(InvoiceModel invoiceModel) {
		this.invoiceModel = invoiceModel;
	}

	public void findByDocument(String documentType, String documentNumber) throws NotExistDomainException {
		this.invoiceModel.findByDocument(documentType, documentNumber);
	}
	
	public void findByDescription(String description) throws NotExistDomainException {
		this.invoiceModel.findByDescription(description);
	}

	public void addProduct(String descriptionProduct, int cant) throws NotExistDomainException {
		this.invoiceModel.addProduct(descriptionProduct, cant);
	}

	public void generateInvioceVip() throws EmptyListProductException, NotDefinedClientException {
		this.invoiceModel.generateInvioceVip();
	}

	public void generateInviocePerson() throws EmptyListProductException, NotDefinedClientException {
		this.invoiceModel.generateInviocePerson();
	}

	public void generateInvioceCompany() throws EmptyListProductException, NotDefinedClientException {
		this.invoiceModel.generateInvoiceCompany();
	}

	public void addObserver(Observer observer) {
		this.invoiceModel.addObserver(observer);
	}

	public Invoice getInvoice() {
		return this.invoiceModel.getInvoice();
	}
	
	public void setInvoice(Invoice invoice) {
		this.invoiceModel.setInvoice(invoice);
	}

	public void setProduct(Product product) {
		this.invoiceModel.setProduct(product);
	}

	public String getProductDescription() {
		return this.invoiceModel.getProductDescription();
	}
	
	public boolean existProduct() {
		return this.invoiceModel.existProduct();
	}
	
	public String getClientName() {
		return this.invoiceModel.getClientName();
	}
	
	public String getClientAddress() {
		return this.invoiceModel.getClientAddress();
	}
	
	public String getClientDocumentNumber() {
		return this.invoiceModel.getClientDocumentNumber();
	}
	
	public String getClientDocumentType() {
		return this.invoiceModel.getClientDocumentType();
	}

	public TableModel getItemTableModel() {
		return this.invoiceModel.getItemTableModel();
	}
	
	public TableModel getMountTableModel() {
		return this.invoiceModel.getMountTableModel();
	}

	public void removeItems() {
		this.invoiceModel.removeItems();
	}

	public void cleanClient() {

		invoiceModel.cleanClient();
	}
}
